package cn.itcast.web.controller.log;

import cn.itcast.domain.log.SysLog;
import cn.itcast.service.log.LogService;
import cn.itcast.web.controller.system.BaseController;
import com.github.pagehelper.PageInfo;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("system/log")
@Log4j
public class LogController extends BaseController {

    @Autowired
    private LogService logService;

    @RequestMapping("list")
    public String list(@RequestParam(defaultValue = "1") Integer pageNum,
                       @RequestParam(defaultValue = "5") Integer pageSize){
        log.info("日志查询开始");
        PageInfo<SysLog> pageInfo = logService.findByPage(getLoginCompanyId(), pageNum, pageSize);

        request.setAttribute("pageInfo",pageInfo);
        return "system/log/log-list";
    }
}
